package com.hiyee.order.service.impl;

import com.hiyee.api.config.ThreadLocalHolder;
import com.hiyee.api.controller.cart.CartControllerApi;
import com.hiyee.api.service.BaseService;
import com.hiyee.order.service.OrderService;
import com.hiyee.pojo.auth.CustomerTokenInfo;
import com.hiyee.pojo.repo.CartCheckoutRepo;
import com.hiyee.pojo.vo.OrderCreateVO;
import com.hiyee.response.ResponseJsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class OrderServiceImpl extends BaseService implements OrderService {

    @Autowired
    private CartControllerApi cartControllerApi;

    @Override
    @Transactional
    public OrderCreateVO create() {
        // 获取当前登录客户
        CustomerTokenInfo customerTokenInfo = ThreadLocalHolder.get();
        // 获取购物车结算数据
        ResponseJsonResult responseJsonResult = cartControllerApi.checkout();
        CartCheckoutRepo cartCheckoutRepo = objectMapper.convertValue(responseJsonResult.getData(), CartCheckoutRepo.class);

        return
    }
}
